package com.zyx;

import com.zyx.entity.Book;
import com.zyx.mapper.BookMapper;
import com.zyx.mapper.DbMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.List;

@SpringBootApplication
public class App implements ApplicationRunner {
    @Autowired
    BookMapper bm;
    @Autowired
    DbMapper dm;


    public static void main(String[] args) {
        SpringApplication.run(App.class,args);
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        System.out.println(dm.version());
        List<Book> list = bm.queryAll();
        for (Book b : list){
            System.out.println(b);
        }
    }
}
